package android;

import stockrobot.android.R;
import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.widget.Toast;

public class settingsActivity  extends PreferenceActivity  {
	
    public static final String PREFS_NAME = "ASTRoPreferenceFile";
    public static final String LOG_LEVEL = "logLevel";
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        addPreferencesFromResource(R.xml.settings_prefrence);
	}

    @Override
    protected void onStop(){
    	super.onStop();
    	 SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
    	 Boolean loglevel  = prefs.getBoolean(LOG_LEVEL, false);
    	// We need an Editor object to make preference changes.
    	// All objects are from android.context.Context      
    	SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);      
    	SharedPreferences.Editor editor = settings.edit();      
    	editor.putBoolean(LOG_LEVEL,loglevel);      
    	// Commit the edits!      
    	editor.commit();    
    }
}
 	


